package com.demo.springmvc.Dao;

import com.demo.springmvc.entities.Department;
import org.springframework.stereotype.Repository;

import java.util.Collection;
import java.util.HashMap;
import java.util.Map;

@Repository
public class DepartmentDao {

    private static Map<Integer,Department> departments;

    static {
        departments = new HashMap<>();
        departments.put(101,new Department(101,"研发部"));
        departments.put(102,new Department(102,"财务部"));
        departments.put(103,new Department(103,"运营部"));
        departments.put(104,new Department(104,"后勤部"));
        departments.put(105,new Department(105,"产品部"));
    }

    public Collection<Department> getDepartments(){
        return departments.values();
    }

    public Department getDeparment(int id){
        return departments.get(id);
    }
}
